﻿using System;
using DAL;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace BLL
{
    public class StallDetailsBLL
    {
        DigitalWorldDataContext db = new DigitalWorldDataContext();
        /// <summary>
        /// Hàm lấy danh sách gian hàng
        /// </summary>
        /// <returns>Danh sách gian hàng</returns>
        public List<stalldetail> getStallDetails()
        {
            return db.stalldetails.ToList();
        }

        /// <summary>
        /// Hàm thêm mới 1 gian hàng
        /// </summary>
        /// <param name="cat">Lớp gian hàng</param>
        public void StallDetails_Insert(stalldetail s)
        {
            db.sp_StallDetails_Insert(s.stallid, s.productid, s.amount, s.status);
            db.SubmitChanges();
        }
        /// <summary>
        /// Hàm cập nhật 1 gian hàng
        /// </summary>
        /// <param name="cat">Lớp gian hàng</param>
        public void StallDetails_Update(stalldetail s)
        {
            db.sp_StallDetails_Update(s.id, s.stallid, s.productid, s.amount, s.status);
            db.SubmitChanges();
        }
        /// <summary>
        /// Hàm xoá 1 gian hàng
        /// </summary>
        /// <param name="cat">Lớp gian hàng</param>
        public void StallDetails_Delete(int id)
        {
            db.sp_StallDetails_Delete(id);
            db.SubmitChanges();
        }
    }
}
